package com.itheima.test.blockingqueue;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie extends Thread {
    private ArrayBlockingQueue<String> arrayBlockingQueue;

    public Foodie(ArrayBlockingQueue<String> arrayBlockingQueue) {
        this.arrayBlockingQueue = arrayBlockingQueue;
    }

    @Override
    public void run() {
        while (true) {
            try {
                System.out.println(arrayBlockingQueue.take());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
